--- /dev/null
+#!/usr/bin/perl\r
+\r
+=pod\r
+\r
+ This script reads the DeLorme Stock Symbols .dim file and writes code\r
+ to be included in the .an1 format handler.\r
+\r
+ You MUST have a copy of the DeLorme .dim file; you can download it\r
+ from the support section of DeLorme's Web site. You want the one\r
+ that contains all of the symbols.\r
+\r
+ To use this script:\r
+\r
+ perl make-an1sym.pl <DeLormeStockSymbols.dim >an1sym.h\r
+\r
+ Copyright (C) 2005 Ronald L. Parker (babelan1perl@parkrrrr.com) \r
+ and Robert Lipe\r
+\r
+ This program is free software; you can redistribute it and/or modify\r
+ it under the terms of the GNU General Public License as published by\r
+ the Free Software Foundation; either version 2 of the License, or\r
+ (at your option) any later version.\r
+\r
+ This program is distributed in the hope that it will be useful,\r
+ but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ GNU General Public License for more details.\r
+\r
+ You should have received a copy of the GNU General Public License\r
+ along with this program; if not, write to the Free Software\r
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\r
+\r
+=cut\r
+\r
+# read a data structure from the input file. \r
+sub shiftunpack {\r
+ my $pattern = shift;\r
+ my @result = unpack( $pattern, $file );\r
+ my $str = pack( $pattern, @result );\r
+ $file = substr( $file, length( $str ));\r
+ @result;\r
+}\r
+\r
+sub skip_bytes {\r
+ my $count = shift;\r
+ $file = substr( $file, $count );\r
+}\r
+\r
+sub decodeGuid {\r
+ @guid = unpack( 'LSSSCCCCCC', shift );\r
+ my $sub = undef;\r
+ my $guid2 = sprintf( '{0x%8.8x,{0x%4.4x, 0x%4.4x, 0x%4.4x},'.\r
+ ' {0x%2.2x, 0x%2.2x, 0x%2.2x, 0x%2.2x, 0x%2.2x, 0x%2.2x}}',\r
+ @guid );\r
+ $sub = $substitutions{ sprintf('%8.8x', @guid)};\r
+ ($guid2, $sub);\r
+}\r
+\r
+sub DoImage {\r
+ # image information - the 'type' we read was actually the low word of the hotspot X coord.\r
+ ($hotspotxhi, $hotspoty, $unk1, $guid, $name ) = \r
+ shiftunpack( 'slla[16]C/a*' );\r
+ $hotspotx = $rec_type + 0x10000*$hotspotxhi;\r
+\r
+ ($guid2,$sub) = decodeGuid( $guid );\r
+ $name = $sub if ( $sub );\r
+ print qq( {$guid2,\n "$name"},\n);\r
+}\r
+\r
+%substitutions = (\r
+ # everything up to and including "mud" is defined\r
+ "012dfac2", "Tractor",\r
+ "012dfac3", "Combine Harvester",\r
+ "012dfac7", "Front-End Loader",\r
+ "fd163780", "Power Shovel",\r
+ "fd163781", "Road Grader",\r
+ "fd163784", "Road Roller",\r
+ "fd163787", "Dump Truck",\r
+ "5673d712", "Skid-Steer Loader", # Bobcat is a registered trademark\r
+ "b86045ac", "Highway Sign",\r
+ "1e129e95", "Orange Cone",\r
+ "adee7d54", "Barricade",\r
+ "a170000f", "Flagger",\r
+ "a425f90e", "Construction Sign",\r
+ "0805b240", "Construction Flasher",\r
+ "56721a6c", "Transit",\r
+ # this group of 8 arrows is defined\r
+ "83f91421", "Small Arrow Left",\r
+ "83f91422", "Small Arrow Right",\r
+ "83f91423", "Small Arrow Up",\r
+ "83f91424", "Small Arrow Down",\r
+ "83f91425", "Small Arrow Up Left",\r
+ "83f91426", "Small Arrow Up Right",\r
+ "83f91427", "Small Arrow Down Left",\r
+ "83f91428", "Small Arrow Down Right",\r
+ "83f91429", "Large Arrow Left",\r
+ "83f9142a", "Large Arrow Right",\r
+ "83f9142b", "Large Arrow Up",\r
+ "83f9142c", "Large Arrow Down",\r
+ "83f9142d", "Large Arrow Down Right",\r
+ "83f9142e", "Large Arrow Down Left",\r
+ "83f9142f", "Large Arrow Up Left",\r
+ "83f91430", "Large Arrow Up Right",\r
+ "8ff0aad1", "Accommodation",\r
+ "af7bf199", "Australia",\r
+ "6bbcc9d1", "Blue Dome Cross",\r
+ "fff920fe", "Green Dome Cross", \r
+ "57e75924", "Business",\r
+ "b09ef4a7", "Airplane",\r
+ "f2833c22", "Amusement Recreation", # tent? on a green background\r
+ "6f0317d6", "Green Square", \r
+ "18a6d3c0", "Red Triangle", \r
+ "86e68ea7", "Red Triangle and Green Square",\r
+ "6afd74bf", "City 4",\r
+ "49dfeb74", "White Square",\r
+ "3eed62c6", "White Triangle",\r
+ "6b521940", "Red Black Diamond Flag",\r
+ "bb8ebaa3", "Yellow Diamond Flag",\r
+ "8e118862", "Small Pink Square",\r
+ "d0ef64c2", "Store",\r
+ "a22b08fb", "Camping",\r
+ "27f57c69", "Green Diamond Flag",\r
+ "e07abb38", "Red Diamond Flag",\r
+ "3a124ac9", "Red Green Diamond Flag",\r
+ "64ed669b", "White Globe",\r
+ "3cb10adc", "Yellow Globe",\r
+ "2779347d", "", #???\r
+ "3ad63f7b", "Black Cross",\r
+ "3e89481e", "Church",\r
+ "68622c10", "Small Dark Green Square",\r
+ "42c6a873", "Small Black Square",\r
+ "50e3b06e", "Danger",\r
+ "369d0b22", "Construction Business",\r
+ "10603b6c", "Airport",\r
+ "8328aab7", "City 5",\r
+ "96411287", "USA",\r
+ "b2f98627", "Diver Down",\r
+ "3fce26d0", "Light Yellow Square",\r
+ "b4b68597", "Education Technology", \r
+ "35d2e6a8", "Computer",\r
+ "4ddc4e96", "Amusement Recreation Red", \r
+ "79f58929", "Telephone Red",\r
+ "0083b377", "Exit",\r
+ "0c232891", "Exit with Services",\r
+ "af63e7c2", "Pizza",\r
+ "d419c693", "Financial Services",\r
+ "70740a81", "City 3",\r
+ "9a582ff6", "Food Store",\r
+ "3cd31689", "", #???\r
+ "952557a6", "", #??? white/black circle\r
+ "03dc278c", "Driving Range",\r
+ "acd28bab", "Golf Municipal",\r
+ "984e7139", "Golf Private",\r
+ "ec5828ab", "Golf Public",\r
+ "b0120d99", "Golf Resort",\r
+ "2ce7685a", "Golf Semi Private",\r
+ "10397049", "Medical Service",\r
+ "2fc28df6", "Home Furnishings",\r
+ "910313db", "Industrial",\r
+ "9e442c6e", "", #???\r
+ "37e2fe4a", "", #???\r
+ "3c756e09", "", #???\r
+ "a1245b1c", "Manufacturing",\r
+ "5bddbd7a", "Note",\r
+ "cb6777e1", "City",\r
+ "bc168c08", "Air Base",\r
+ "a8857b0f", "Battlefield",\r
+ "06db55c1", "Mining",\r
+ "cc61b277", "Mountain",\r
+ "fde13186", "Capital",\r
+ "b14d90d1", "Route",\r
+ "7eabc63f", "Overnight",\r
+ "ac39d8b9", "Route End Active",\r
+ "e1b9d86b", "Route End Inactive",\r
+ "98712315", "Fuel Stop",\r
+ "e5ea5b38", "Route Start Active",\r
+ "18fd0d49", "Route Start Inactive",\r
+ "2f52144b", "Route Stop Active",\r
+ "faf8d826", "Route Stop Inactive",\r
+ "ff44cae2", "Route Via",\r
+ "5a50d59b", "Radiation Green",\r
+ "19556023", "Radiation Red",\r
+ "a54be251", "Electricity",\r
+ "d793ff0c", "Personal Furnishings",\r
+ "00f90733", "Personal Services",\r
+ "ea677f24", "Telephone Black",\r
+ "2d8a05b5", "Government Light",\r
+ "40c64dfc", "Airport Red Square",\r
+ "f27adb5d", "Propeller Aircraft",\r
+ "5a718e13", "Jet Aircraft",\r
+ "0a471039", "Government",\r
+ "4a59da2f", "USA Regional",\r
+ "f16500a9", "House 2",\r
+ "7b05524d", "Picnic",\r
+ "b88ad7a1", "Restaurant",\r
+ "dc48a20a", "Store 2",\r
+ "6b5ab040", "", # ???\r
+ "153b2cff", "Blue Star",\r
+ "f276f6b3", "", # ???\r
+ "91d242c8", "Running",\r
+ "8b0078db", "Transportation",\r
+ "0599f6c9", "Fishing 2",\r
+ "7389128c", "Automotive",\r
+ "0362b593", "Cloudy",\r
+ "f0717a94", "Partly Cloudy",\r
+ "14486bbc", "Mostly Cloudy",\r
+ "7a258c70", "Hurricane",\r
+ "eff260d4", "Lightning",\r
+ "c3d70220", "Rain",\r
+ # everything else is defined\r
+ # They defined two red flags. Ooops.\r
+ "f2dfbc95", "Red Flag 2"\r
+);\r
+\r
+sub print_header {\r
+print <<'END';\r
+/*\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+ THIS FILE IS AUTOMATICALLY GENERATED\r
+\r
+\r
+ Please change make-an1sym.pl and\r
+ regenerate it rather than changing\r
+ this file directly.\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+*/\r
+\r
+/*\r
+ Read DeLorme drawing files (.an1) - supplemental (included by an1.c)\r
+\r
+ Copyright (C) 2005 Ron Parker and Robert Lipe.\r
+\r
+ This program is free software; you can redistribute it and/or modify\r
+ it under the terms of the GNU General Public License as published by\r
+ the Free Software Foundation; either version 2 of the License, or\r
+ (at your option) any later version.\r
+\r
+ This program is distributed in the hope that it will be useful,\r
+ but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ GNU General Public License for more details.\r
+\r
+ You should have received a copy of the GNU General Public License\r
+ along with this program; if not, write to the Free Software\r
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\r
+\r
+ */\r
+\r
+static struct defguid {\r
+ guid_t guid;\r
+ const char* name;\r
+} default_guids[] = {\r
+END\r
+}\r
+\r
+sub print_footer {\r
+print <<'END';\r
+};\r
+\r
+static int FindIconByName(const char* name, guid_t* guid)\r
+{\r
+ for (unsigned int i = 0; i < (sizeof(default_guids)/sizeof(struct defguid)); ++i) {\r
+ if (!case_ignore_strcmp(name, default_guids[i].name)) {\r
+ *guid = default_guids[i].guid;\r
+ return 1;\r
+ }\r
+ }\r
+ return 0;\r
+}\r
+\r
+static int FindIconByGuid(const guid_t* guid, const char** name)\r
+{\r
+ for (unsigned int i = 0; i < (sizeof(default_guids)/sizeof(struct defguid)); ++i) {\r
+ /* don't compare any structure padding */\r
+ if ((guid->l == default_guids[i].guid.l) &&\r
+ memcmp(guid->s, default_guids[i].guid.s, sizeof(guid->s)) &&\r
+ memcmp(guid->c, default_guids[i].guid.c, sizeof(guid->c))) {\r
+ *name = default_guids[i].name;\r
+ return 1;\r
+ }\r
+ }\r
+ return 0;\r
+}\r
+END\r
+}\r
+\r
+\r
+# read file\r
+undef $/;\r
+$file = <>;\r
+\r
+# read file header\r
+($magic, $unk1 ) = shiftunpack( 'ss' );\r
+\r
+# read bitmap info\r
+($unk2) = shiftunpack( 'l' );\r
+\r
+print_header;\r
+\r
+while ( length($file) ) {\r
+ ($rec_type) = shiftunpack( 's' );\r
+ if ( $rec_type == 0x4c49 ) { # 'IL'\r
+ # I don't know what this structure is, but it appears twice in my test files.\r
+ ($unk10101, $unke, $unkc, $unk18_1, $unk18_2, $unkneg1_1,\r
+ $unk20, $unkneg1_2, $unkneg1_3) = shiftunpack( 'lsssslsll');\r
+ }\r
+ elsif ( $rec_type == 0x4d42 ) { # 'BM'\r
+ # This is a standard BMP file, documented in MSDN.\r
+ # BITMAPFILEHEADER\r
+ ($fhsize, $res_0_1, $res_0_2, $bitoffset) = shiftunpack( 'lssl' );\r
+ # BITMAPINFOHEADER\r
+ ($bmisize, $width, $height, $planes, $bpp, $compression, \r
+ $size, $xppm, $yppm, $colused, $colimprt ) = shiftunpack( 'lllssllllll');\r
+ # palette\r
+ $palettesize = $bitoffset - $bmisize - 14; # 14 bytes in BMFH, including the 'BM'\r
+ skip_bytes( $palettesize );\r
+ # image\r
+ skip_bytes( $size );\r
+ }\r
+ elsif ($rec_type == 0 ) { # crap\r
+ ($a, $b, $c, $d, $e, $f) = shiftunpack( 'llllll' );\r
+ if ( $c ) { \r
+ $file = pack( 'llllll', ($a, $b, $c, $d, $e, $f)) . $file;\r
+ DoImage;\r
+ }\r
+ }\r
+ else {\r
+ DoImage;\r
+ }\r
+} \r
+\r
+print_footer;\r
--- /dev/null
+/*
+ Naviguide Routes
+
+
+ Copyright (C) 2009 Erez Zuler
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+ */
+
+#include "defs.h"
+#include "csv_util.h"
+#include "jeeps/gpsmath.h"
+#include <QtCore/QDebug>
+#include <QtCore/QTextCodec>
+#include <cmath>
+
+#define MYNAME "Naviguide"
+
+
+/************* Specific Naviguide data formats ****************/
+
+/* Naviguide file header */
+struct ng_file_header_t {
+ uint16_t nof_wp; /* Little endean format */
+ unsigned char pad1[6]; /* 0xff, 0xff, 0x01, 0x00, 0x06, 0x00 */
+ char signature[9]; /* cWaypoint */
+ unsigned char pad2[4]; /* 0x01, 0x00, 0x00, 0x00 */
+};
+
+/* Naviguide waypoint/rout data */
+struct ng_wp_data_t {
+ unsigned char pad1[8]; /* 0xfe, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00 */
+ /* coordination are in old israeli grid */
+ int32_t East;
+ int32_t North;
+ unsigned char pad2[2]; /* 0x01, 0x01 */
+ uint32_t Alt;
+ char CommentLength;
+};
+
+struct ng_next_wp_t {
+ unsigned char pad1[2]; /* 0x01, 0x80 */
+ uint16_t next_wp;
+ unsigned char pad2[2]; /* 0x00, 0x00 */
+};
+
+struct ng_wp_no_comment_t {
+ unsigned char chHeaderLen;
+ char strName[255];
+ ng_wp_data_t wp_data;
+};
+
+
+/* Global variables */
+
+static gbfile* file_in, *file_out;
+static uint16_t nof_wp;
+static route_head* rte_head;
+static ng_file_header_t ng_file_header;
+static ng_wp_no_comment_t WPNC;
+static ng_next_wp_t ng_next_wp;
+static char strComment[101];
+
+/* Process options */
+/* wp - process only waypoints */
+/* rte - process as route */
+/* wprte - Process waypoints and route */
+static char* process = nullptr;
+static char* reorder = nullptr;
+static int process_rte = 1;
+static int reorder_wp = 0;
+
+static char temp_short_name[5];
+
+
+
+
+/* Forward declarations */
+static void ng_read_file_header();
+
+static
+QVector<arglist_t> ng_args = {
+ {
+ "output", &process, "'wp' - Create waypoint file , 'rte' - Create route file",
+ "rte", ARGTYPE_STRING, ARG_NOMINMAX, nullptr
+ },
+ {
+ "reorder", &reorder, "'n' - Keep the existing wp name, 'y' - rename waypoints",
+ "n", ARGTYPE_STRING, ARG_NOMINMAX, nullptr
+ },
+
+};
+
+/*===================Utilities ==========================================*/
+
+static void
+ng_convert_datum(Waypoint* wpt)
+{
+ double lat, lon;
+
+ auto east = (double) WPNC.wp_data.East;
+ auto north = (double) WPNC.wp_data.North;
+ auto alt = (double) WPNC.wp_data.Alt;
+
+ GPS_Math_ICS_EN_To_WGS84(east, north, &lat, &lon);
+ wpt->latitude = lat;
+ wpt->longitude = lon;
+ wpt->altitude = alt;
+}
+
+
+
+/*=================== File read/write utilities ==========================================*/
+
+static void
+ng_fwrite_wp_data(const QString& s, const QString& d, ng_wp_data_t* wp_data, gbfile* f)
+{
+ char z[50];
+
+ memset(z, 0, 50);
+ int i = strlen(STRFROMUNICODE(s));
+ gbfputc(i, f);
+ gbfwrite(STRFROMUNICODE(s), 1, i, f);
+
+ gbfwrite(&wp_data->pad1[0], 8, 1, f);
+ gbfputint32(wp_data->East, f);
+ gbfputint32(wp_data->North, f);
+ gbfwrite(&wp_data->pad2[0], 2, 1, f);
+ gbfputint32(wp_data->Alt, f);
+
+ i = strlen(STRFROMUNICODE(d));
+ gbfputc(i, f);
+ gbfwrite(STRFROMUNICODE(d), 1, i, f);
+ gbfwrite(z, 44, 1, f);
+}
+
+static void
+ng_fwrite_next_wp(ng_next_wp_t* nwp, gbfile* f)
+{
+ gbfwrite(nwp->pad1, 2, 1, f);
+ gbfputint16(nwp->next_wp, f);
+ gbfwrite(nwp->pad2, 2, 1, f);
+}
+
+static void
+ng_fread_wp_data(char* d, ng_wp_no_comment_t* wpnc, gbfile* f)
+{
+ gbfread(&wpnc->chHeaderLen ,sizeof(wpnc->chHeaderLen), 1, f);
+ gbfread(&wpnc->strName, wpnc->chHeaderLen, 1, f);
+ wpnc->strName[wpnc->chHeaderLen] = 0;
+
+
+ gbfread(&wpnc->wp_data, 8, 1, f);
+ wpnc->wp_data.East = gbfgetint32(f);
+ wpnc->wp_data.North = gbfgetint32(f);
+ gbfread(&wpnc->wp_data.pad2,2, 1, f);
+ wpnc->wp_data.Alt = gbfgetint32(f);
+ gbfread(&wpnc->wp_data.CommentLength, 1, 1, f);
+ int i = (int)wpnc->wp_data.CommentLength;
+
+
+ /* Read the comment field */
+ gbfread(d, i + 44, 1, f);
+
+}
+
+static void
+ng_fread_next_wp(ng_next_wp_t* nwp, gbfile* f)
+{
+ gbfread(&nwp->pad1, 2, 1, f);
+ nwp->next_wp = gbfgetint16(f);
+ gbfread(&nwp->pad2, 2, 1, f);
+}
+
+/* =================== Write data functions ====================================*/
+
+static void
+ng_fill_header_default()
+{
+ ng_file_header_t default_header = {
+ 0x00,
+ {0xff, 0xff, 0x01, 0x00, 0x09, 0x00},
+ {'C', 'W', 'a', 'y', 'P', 'o', 'i', 'n', 't'},
+ {0x01, 0x00, 0x00, 0x00},
+ };
+
+ ng_file_header =default_header;
+
+}
+
+
+static void
+ng_fill_waypoint_default()
+{
+ ng_wp_data_t default_wp = {
+ {0xfe, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00},
+ 0,
+ 0,
+ {0x01, 0x01},
+ 0,
+ 0x00,
+
+ };
+
+ ng_next_wp_t default_ng_next_wp = {
+ {0x01, 0x80},
+ 0,
+ {0x00, 0x00},
+ };
+
+ WPNC.wp_data = default_wp;
+ ng_next_wp = default_ng_next_wp;
+}
+
+
+static void
+ng_waypt_rd(const Waypoint* wpt)
+{
+ char z[50];
+ double lat, lon;
+ static int current_wp_ix=0;
+
+ memset(z, 0, 50);
+ current_wp_ix++;
+ ng_fill_waypoint_default();
+
+ if (!GPS_Math_WGS84_To_ICS_EN(wpt->latitude, wpt->longitude, &lon, &lat)) {
+ fatal(MYNAME ": Waypoint %d is out of the israeli grid area", current_wp_ix);
+ }
+
+ WPNC.wp_data.North = (int32_t)lat;
+ WPNC.wp_data.East = (int32_t)lon;
+
+ QString s;
+ if (reorder_wp) {
+ sprintf(temp_short_name, "A%03d", current_wp_ix);
+ s = temp_short_name;
+ }
+
+ else {
+ s = wpt->shortname;
+ }
+
+ ng_fwrite_wp_data(s, wpt->description, &WPNC.wp_data, file_out);
+
+
+ /* if not Last WP, write the next one index */
+
+ if (nof_wp > current_wp_ix) {
+ ng_next_wp.next_wp = current_wp_ix + 1;
+
+ ng_fwrite_next_wp(&ng_next_wp, file_out);
+
+ }
+}
+
+static void
+header_write()
+{
+ ng_file_header.nof_wp = nof_wp;
+ gbfputint16(nof_wp, file_out);
+ gbfwrite(&ng_file_header.pad1[0], 19, 1, file_out);
+
+}
+
+
+static void
+data_write()
+{
+ nof_wp = waypt_count();
+ if (nof_wp) {
+ header_write();
+ waypt_disp_all(ng_waypt_rd);
+ } else {
+ nof_wp = route_waypt_count();
+ if (nof_wp) {
+ header_write();
+ route_disp_all(nullptr, nullptr, ng_waypt_rd);
+ }
+ }
+}
+
+
+static void
+wr_init(const QString& fname)
+{
+ file_out = gbfopen_le(fname, "wb", MYNAME);
+ ng_fill_header_default();
+ if (nullptr != reorder)
+ if (!case_ignore_strcmp(reorder, "y")) {
+ reorder_wp = 1;
+ }
+
+}
+
+static void
+wr_deinit()
+{
+ gbfclose(file_out);
+}
+
+/*=========================== Read data functions ==================================*/
+
+static void
+rd_init(const QString& fname)
+{
+ file_in = gbfopen_le(fname, "rb", MYNAME);
+
+ ng_read_file_header();
+
+ if (nullptr != process) {
+ if (!case_ignore_strcmp(process, "wp")) {
+ process_rte = 0;
+ }
+ if (!case_ignore_strcmp(process, "rte")) {
+ process_rte = 1;
+ }
+ }
+
+
+}
+
+static void
+rd_deinit()
+{
+ gbfclose(file_in);
+ file_in = nullptr;
+}
+
+
+
+static void
+ng_read_file_header()
+{
+
+ nof_wp = gbfgetint16(file_in);
+ gbfread(&ng_file_header.pad1[0], 19, 1, file_in);
+ ng_file_header.nof_wp = nof_wp;
+
+
+ if (strncmp("CWayPoint", ng_file_header.signature, 9)) {
+ fatal("\nInvalid Naviguide file format\n");
+ }
+
+
+}
+
+static void
+data_read()
+{
+ if (process_rte) {
+ rte_head = route_head_alloc();
+ route_add_head(rte_head);
+ }
+
+ for (int n = 0; n < nof_wp; ++n) {
+
+ auto* wpt_tmp = new Waypoint;
+
+ /* Read waypoint data */
+
+ ng_fread_wp_data(strComment, &WPNC, file_in);
+
+
+ if (n < nof_wp - 1) {
+ /*
+ gbfread (&ng_next_wp.pad1[0], 2, 1, file_in);
+ ng_next_wp.next_wp = gbfgetint16 (file_in);
+ gbfread (&ng_next_wp.pad2[0], 2, 1, file_in);
+ */
+ ng_fread_next_wp(&ng_next_wp, file_in);
+
+ }
+ /* Clear commas form the comment for CSV file commonality */
+ for (unsigned i = 0; i <strlen(strComment); ++i) {
+ if (strComment[i] == ',') {
+ strComment[i] = ' ';
+ }
+ }
+
+ /* put the data in the waypoint structure */
+ ng_convert_datum(wpt_tmp);
+ wpt_tmp->shortname = STRTOUNICODE(WPNC.strName);
+ wpt_tmp->description = STRTOUNICODE(strComment);
+
+ if (process_rte) {
+ route_add_wpt(rte_head, wpt_tmp);
+ } else {
+ waypt_add(wpt_tmp);
+ }
+ }
+} /* data_read */
+
+
+
+ff_vecs_t ng_vecs = {
+ ff_type_file,
+ FF_CAP_RW_WPT,
+ rd_init,
+ wr_init,
+ rd_deinit,
+ wr_deinit,
+ data_read,
+ data_write,
+ nullptr,
+ &ng_args,
+ CET_CHARSET_HEBREW, 0
+ , NULL_POS_OPS,
+ nullptr
+};
+++ /dev/null
-#!/usr/bin/perl\r
-\r
-=pod\r
-\r
- This script reads the DeLorme Stock Symbols .dim file and writes code\r
- to be included in the .an1 format handler.\r
-\r
- You MUST have a copy of the DeLorme .dim file; you can download it\r
- from the support section of DeLorme's Web site. You want the one\r
- that contains all of the symbols.\r
-\r
- To use this script:\r
-\r
- perl make-an1sym.pl <DeLormeStockSymbols.dim >an1sym.h\r
-\r
- Copyright (C) 2005 Ronald L. Parker (babelan1perl@parkrrrr.com) \r
- and Robert Lipe\r
-\r
- This program is free software; you can redistribute it and/or modify\r
- it under the terms of the GNU General Public License as published by\r
- the Free Software Foundation; either version 2 of the License, or\r
- (at your option) any later version.\r
-\r
- This program is distributed in the hope that it will be useful,\r
- but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
- GNU General Public License for more details.\r
-\r
- You should have received a copy of the GNU General Public License\r
- along with this program; if not, write to the Free Software\r
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\r
-\r
-=cut\r
-\r
-# read a data structure from the input file. \r
-sub shiftunpack {\r
- my $pattern = shift;\r
- my @result = unpack( $pattern, $file );\r
- my $str = pack( $pattern, @result );\r
- $file = substr( $file, length( $str ));\r
- @result;\r
-}\r
-\r
-sub skip_bytes {\r
- my $count = shift;\r
- $file = substr( $file, $count );\r
-}\r
-\r
-sub decodeGuid {\r
- @guid = unpack( 'LSSSCCCCCC', shift );\r
- my $sub = undef;\r
- my $guid2 = sprintf( '{0x%8.8x,{0x%4.4x, 0x%4.4x, 0x%4.4x},'.\r
- ' {0x%2.2x, 0x%2.2x, 0x%2.2x, 0x%2.2x, 0x%2.2x, 0x%2.2x}}',\r
- @guid );\r
- $sub = $substitutions{ sprintf('%8.8x', @guid)};\r
- ($guid2, $sub);\r
-}\r
-\r
-sub DoImage {\r
- # image information - the 'type' we read was actually the low word of the hotspot X coord.\r
- ($hotspotxhi, $hotspoty, $unk1, $guid, $name ) = \r
- shiftunpack( 'slla[16]C/a*' );\r
- $hotspotx = $rec_type + 0x10000*$hotspotxhi;\r
-\r
- ($guid2,$sub) = decodeGuid( $guid );\r
- $name = $sub if ( $sub );\r
- print qq( {$guid2,\n "$name"},\n);\r
-}\r
-\r
-%substitutions = (\r
- # everything up to and including "mud" is defined\r
- "012dfac2", "Tractor",\r
- "012dfac3", "Combine Harvester",\r
- "012dfac7", "Front-End Loader",\r
- "fd163780", "Power Shovel",\r
- "fd163781", "Road Grader",\r
- "fd163784", "Road Roller",\r
- "fd163787", "Dump Truck",\r
- "5673d712", "Skid-Steer Loader", # Bobcat is a registered trademark\r
- "b86045ac", "Highway Sign",\r
- "1e129e95", "Orange Cone",\r
- "adee7d54", "Barricade",\r
- "a170000f", "Flagger",\r
- "a425f90e", "Construction Sign",\r
- "0805b240", "Construction Flasher",\r
- "56721a6c", "Transit",\r
- # this group of 8 arrows is defined\r
- "83f91421", "Small Arrow Left",\r
- "83f91422", "Small Arrow Right",\r
- "83f91423", "Small Arrow Up",\r
- "83f91424", "Small Arrow Down",\r
- "83f91425", "Small Arrow Up Left",\r
- "83f91426", "Small Arrow Up Right",\r
- "83f91427", "Small Arrow Down Left",\r
- "83f91428", "Small Arrow Down Right",\r
- "83f91429", "Large Arrow Left",\r
- "83f9142a", "Large Arrow Right",\r
- "83f9142b", "Large Arrow Up",\r
- "83f9142c", "Large Arrow Down",\r
- "83f9142d", "Large Arrow Down Right",\r
- "83f9142e", "Large Arrow Down Left",\r
- "83f9142f", "Large Arrow Up Left",\r
- "83f91430", "Large Arrow Up Right",\r
- "8ff0aad1", "Accommodation",\r
- "af7bf199", "Australia",\r
- "6bbcc9d1", "Blue Dome Cross",\r
- "fff920fe", "Green Dome Cross", \r
- "57e75924", "Business",\r
- "b09ef4a7", "Airplane",\r
- "f2833c22", "Amusement Recreation", # tent? on a green background\r
- "6f0317d6", "Green Square", \r
- "18a6d3c0", "Red Triangle", \r
- "86e68ea7", "Red Triangle and Green Square",\r
- "6afd74bf", "City 4",\r
- "49dfeb74", "White Square",\r
- "3eed62c6", "White Triangle",\r
- "6b521940", "Red Black Diamond Flag",\r
- "bb8ebaa3", "Yellow Diamond Flag",\r
- "8e118862", "Small Pink Square",\r
- "d0ef64c2", "Store",\r
- "a22b08fb", "Camping",\r
- "27f57c69", "Green Diamond Flag",\r
- "e07abb38", "Red Diamond Flag",\r
- "3a124ac9", "Red Green Diamond Flag",\r
- "64ed669b", "White Globe",\r
- "3cb10adc", "Yellow Globe",\r
- "2779347d", "", #???\r
- "3ad63f7b", "Black Cross",\r
- "3e89481e", "Church",\r
- "68622c10", "Small Dark Green Square",\r
- "42c6a873", "Small Black Square",\r
- "50e3b06e", "Danger",\r
- "369d0b22", "Construction Business",\r
- "10603b6c", "Airport",\r
- "8328aab7", "City 5",\r
- "96411287", "USA",\r
- "b2f98627", "Diver Down",\r
- "3fce26d0", "Light Yellow Square",\r
- "b4b68597", "Education Technology", \r
- "35d2e6a8", "Computer",\r
- "4ddc4e96", "Amusement Recreation Red", \r
- "79f58929", "Telephone Red",\r
- "0083b377", "Exit",\r
- "0c232891", "Exit with Services",\r
- "af63e7c2", "Pizza",\r
- "d419c693", "Financial Services",\r
- "70740a81", "City 3",\r
- "9a582ff6", "Food Store",\r
- "3cd31689", "", #???\r
- "952557a6", "", #??? white/black circle\r
- "03dc278c", "Driving Range",\r
- "acd28bab", "Golf Municipal",\r
- "984e7139", "Golf Private",\r
- "ec5828ab", "Golf Public",\r
- "b0120d99", "Golf Resort",\r
- "2ce7685a", "Golf Semi Private",\r
- "10397049", "Medical Service",\r
- "2fc28df6", "Home Furnishings",\r
- "910313db", "Industrial",\r
- "9e442c6e", "", #???\r
- "37e2fe4a", "", #???\r
- "3c756e09", "", #???\r
- "a1245b1c", "Manufacturing",\r
- "5bddbd7a", "Note",\r
- "cb6777e1", "City",\r
- "bc168c08", "Air Base",\r
- "a8857b0f", "Battlefield",\r
- "06db55c1", "Mining",\r
- "cc61b277", "Mountain",\r
- "fde13186", "Capital",\r
- "b14d90d1", "Route",\r
- "7eabc63f", "Overnight",\r
- "ac39d8b9", "Route End Active",\r
- "e1b9d86b", "Route End Inactive",\r
- "98712315", "Fuel Stop",\r
- "e5ea5b38", "Route Start Active",\r
- "18fd0d49", "Route Start Inactive",\r
- "2f52144b", "Route Stop Active",\r
- "faf8d826", "Route Stop Inactive",\r
- "ff44cae2", "Route Via",\r
- "5a50d59b", "Radiation Green",\r
- "19556023", "Radiation Red",\r
- "a54be251", "Electricity",\r
- "d793ff0c", "Personal Furnishings",\r
- "00f90733", "Personal Services",\r
- "ea677f24", "Telephone Black",\r
- "2d8a05b5", "Government Light",\r
- "40c64dfc", "Airport Red Square",\r
- "f27adb5d", "Propeller Aircraft",\r
- "5a718e13", "Jet Aircraft",\r
- "0a471039", "Government",\r
- "4a59da2f", "USA Regional",\r
- "f16500a9", "House 2",\r
- "7b05524d", "Picnic",\r
- "b88ad7a1", "Restaurant",\r
- "dc48a20a", "Store 2",\r
- "6b5ab040", "", # ???\r
- "153b2cff", "Blue Star",\r
- "f276f6b3", "", # ???\r
- "91d242c8", "Running",\r
- "8b0078db", "Transportation",\r
- "0599f6c9", "Fishing 2",\r
- "7389128c", "Automotive",\r
- "0362b593", "Cloudy",\r
- "f0717a94", "Partly Cloudy",\r
- "14486bbc", "Mostly Cloudy",\r
- "7a258c70", "Hurricane",\r
- "eff260d4", "Lightning",\r
- "c3d70220", "Rain",\r
- # everything else is defined\r
- # They defined two red flags. Ooops.\r
- "f2dfbc95", "Red Flag 2"\r
-);\r
-\r
-sub print_header {\r
-print <<'END';\r
-/*\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
- THIS FILE IS AUTOMATICALLY GENERATED\r
-\r
-\r
- Please change make-an1sym.pl and\r
- regenerate it rather than changing\r
- this file directly.\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-*/\r
-\r
-/*\r
- Read DeLorme drawing files (.an1) - supplemental (included by an1.c)\r
-\r
- Copyright (C) 2005 Ron Parker and Robert Lipe.\r
-\r
- This program is free software; you can redistribute it and/or modify\r
- it under the terms of the GNU General Public License as published by\r
- the Free Software Foundation; either version 2 of the License, or\r
- (at your option) any later version.\r
-\r
- This program is distributed in the hope that it will be useful,\r
- but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
- GNU General Public License for more details.\r
-\r
- You should have received a copy of the GNU General Public License\r
- along with this program; if not, write to the Free Software\r
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\r
-\r
- */\r
-\r
-static struct defguid {\r
- guid_t guid;\r
- const char* name;\r
-} default_guids[] = {\r
-END\r
-}\r
-\r
-sub print_footer {\r
-print <<'END';\r
-};\r
-\r
-static int FindIconByName(const char* name, guid_t* guid)\r
-{\r
- for (unsigned int i = 0; i < (sizeof(default_guids)/sizeof(struct defguid)); ++i) {\r
- if (!case_ignore_strcmp(name, default_guids[i].name)) {\r
- *guid = default_guids[i].guid;\r
- return 1;\r
- }\r
- }\r
- return 0;\r
-}\r
-\r
-static int FindIconByGuid(const guid_t* guid, const char** name)\r
-{\r
- for (unsigned int i = 0; i < (sizeof(default_guids)/sizeof(struct defguid)); ++i) {\r
- /* don't compare any structure padding */\r
- if ((guid->l == default_guids[i].guid.l) &&\r
- memcmp(guid->s, default_guids[i].guid.s, sizeof(guid->s)) &&\r
- memcmp(guid->c, default_guids[i].guid.c, sizeof(guid->c))) {\r
- *name = default_guids[i].name;\r
- return 1;\r
- }\r
- }\r
- return 0;\r
-}\r
-END\r
-}\r
-\r
-\r
-# read file\r
-undef $/;\r
-$file = <>;\r
-\r
-# read file header\r
-($magic, $unk1 ) = shiftunpack( 'ss' );\r
-\r
-# read bitmap info\r
-($unk2) = shiftunpack( 'l' );\r
-\r
-print_header;\r
-\r
-while ( length($file) ) {\r
- ($rec_type) = shiftunpack( 's' );\r
- if ( $rec_type == 0x4c49 ) { # 'IL'\r
- # I don't know what this structure is, but it appears twice in my test files.\r
- ($unk10101, $unke, $unkc, $unk18_1, $unk18_2, $unkneg1_1,\r
- $unk20, $unkneg1_2, $unkneg1_3) = shiftunpack( 'lsssslsll');\r
- }\r
- elsif ( $rec_type == 0x4d42 ) { # 'BM'\r
- # This is a standard BMP file, documented in MSDN.\r
- # BITMAPFILEHEADER\r
- ($fhsize, $res_0_1, $res_0_2, $bitoffset) = shiftunpack( 'lssl' );\r
- # BITMAPINFOHEADER\r
- ($bmisize, $width, $height, $planes, $bpp, $compression, \r
- $size, $xppm, $yppm, $colused, $colimprt ) = shiftunpack( 'lllssllllll');\r
- # palette\r
- $palettesize = $bitoffset - $bmisize - 14; # 14 bytes in BMFH, including the 'BM'\r
- skip_bytes( $palettesize );\r
- # image\r
- skip_bytes( $size );\r
- }\r
- elsif ($rec_type == 0 ) { # crap\r
- ($a, $b, $c, $d, $e, $f) = shiftunpack( 'llllll' );\r
- if ( $c ) { \r
- $file = pack( 'llllll', ($a, $b, $c, $d, $e, $f)) . $file;\r
- DoImage;\r
- }\r
- }\r
- else {\r
- DoImage;\r
- }\r
-} \r
-\r
-print_footer;\r
--- /dev/null
+#
+# Alan Map500 tracklogs< test
+#
+rm -f ${TMPDIR}/alantrl*
+gpsbabel -i alantrl -f ${REFERENCE}/alantrl.trl -o alantrl -F ${TMPDIR}/alantrl-new.trl
+gpsbabel -i alantrl -f ${TMPDIR}/alantrl-new.trl -o gpx -F ${TMPDIR}/alantrl-new.gpx
+compare ${REFERENCE}/alantrl.gpx ${TMPDIR}/alantrl-new.gpx
+
--- /dev/null
+#
+# Alan MAp500 waypoint & route test
+#
+rm -f ${TMPDIR}/alanwpr*
+gpsbabel -i alanwpr -f ${REFERENCE}/alanwpr.wpr -o alanwpr -F ${TMPDIR}/alanwpr-new.wpr
+gpsbabel -i alanwpr -f ${TMPDIR}/alanwpr-new.wpr -o gpx -F ${TMPDIR}/alanwpr-new.gpx
+compare ${REFERENCE}/alanwpr.gpx ${TMPDIR}/alanwpr-new.gpx
+
--- /dev/null
+
+#
+# DeLorme .an1 tests
+#
+rm -f ${TMPDIR}/an1.out
+gpsbabel -i an1 -f ${REFERENCE}/foo.an1 -o csv -F ${TMPDIR}/an1.out
+compare ${REFERENCE}/an1-in.ref ${TMPDIR}/an1.out
+
+rm -f ${TMPDIR}/an1.out
+gpsbabel -i an1 -f ${REFERENCE}/foo.an1 -o an1 -F ${TMPDIR}/an1.out
+bincompare ${TMPDIR}/an1.out ${REFERENCE}/an1-an1.ref
+
+rm -f ${TMPDIR}/an1.out
+gpsbabel -i xmap -f ${REFERENCE}/xmap -o an1 -F ${TMPDIR}/an1.out
+bincompare ${TMPDIR}/an1.out ${REFERENCE}/an1-out.ref
+
+#rm -f ${TMPDIR}/an1.out
+#gpsbabel -i gpx -f ${REFERENCE}/an1-in.gpx -o an1 -F ${TMPDIR}/an1.out
+#bincompare ${TMPDIR}/an1.out ${REFERENCE}/an1-line-out.ref
+
--- /dev/null
+#
+# Naivguide
+#
+gpsbabel -i naviguide -f ${REFERENCE}/route/naviguide-route.twl -o gpx -F ${TMPDIR}/naviguide.gpx
+compare ${REFERENCE}/route/naviguide.gpx ${TMPDIR}/naviguide.gpx
+# Make sure ICS negative eastings and northings work.
+gpsbabel -i gpx -f ${REFERENCE}/ics.gpx -o naviguide -F ${TMPDIR}/ics.gpx.naviguide
+gpsbabel -i naviguide -f ${TMPDIR}/ics.gpx.naviguide -o gpx -F ${TMPDIR}/ics.gpx.naviguide.gpx
+compare ${REFERENCE}/ics.gpx.naviguide.gpx ${TMPDIR}/ics.gpx.naviguide.gpx
--- /dev/null
+#
+# NetStumbler Summary File (read-only)
+#
+rm -f ${TMPDIR}/netstumbler.mps
+gpsbabel -i netstumbler -f ${REFERENCE}/netstumbler.txt -o mapsource -F ${TMPDIR}/netstumbler.mps
+bincompare ${TMPDIR}/netstumbler.mps ${REFERENCE}/netstumbler.mps
+